<template>
    <el-form ref="form" label-width="140px" class="mt">
        <el-form-item label="会员服务期">
            <el-tag type="primary" size="small">{{fuwu}}天</el-tag>
        </el-form-item>
        <el-form-item label="会员铺垫期">
            <el-tag type="primary" size="small">{{pudian}}天</el-tag>
        </el-form-item>
        <el-form-item label="会员销售期">
            <el-tag type="primary" size="small">无日期限制</el-tag>
        </el-form-item>
        <el-form-item label="修改会员三期">
            <el-button type="warning" icon="el-icon-h-edit" size="small" @click="dialogFormVisible = true" v-qx="permission.edit">修改</el-button>
        </el-form-item>
        <el-dialog title="修改会员三期" :visible.sync="dialogFormVisible">
            <el-form ref="form" label-width="80px">
                <el-form-item label="服务天数">
                    <el-input v-model="fuwu" size="small" placeholder="请输入客户服务天数"></el-input>
                </el-form-item>
                <el-form-item label="铺垫天数">
                    <el-input v-model="pudian" size="small" placeholder="请输入客户铺垫天数"></el-input>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="dialogFormVisible = false">取 消</el-button>
                <el-button type="primary" @click="tijiao">确 定</el-button>
            </div>
        </el-dialog>
    </el-form>
</template>
<script>
import C from '@/common/common.js'
export default {
  name: 'guestThreephase',
  data () {
    return {
      fuwu: '',
      pudian: '',
      dialogFormVisible: false,
      permission: {
        edit: 'sanqi_edit'
      }
    }
  },
  mounted () {
    this.getInfo()
  },
  methods: {
    tijiao: async function () {
      let res = await C.ajax('/organization/orset/sanqi', { fuwuqi: this.fuwu, pudianqi: this.pudian }, 'post')
      if (res) {
        C.success(res.data)
        this.getInfo()
      }
      this.dialogFormVisible = false
    },
    getInfo: async function () {
      let res = await C.ajax('/organization/orset/sanqi')
      if (res) {
        this.fuwu = res.fuwuqi
        this.pudian = res.pudianqi
      }
    }
  }
}
</script>